home *** CD-ROM | disk | FTP | other *** search
/ Internet.Works 41 / Issue 41.iso / pc / PCSoftware / Netscape 6 Official Release / nim.xpi / bin / chrome / aim.jar / content / aim / findAFriend1_2.js < prev    next >
Encoding:
JavaScript  |  2000-09-13  |  4.2 KB  |  138 lines

  1. /* 
  2.  * The contents of this file are subject to the Netscape Public
  3.  * License Version 1.1 (the "License"); you may not use this file
  4.  * except in compliance with the License. You may obtain a copy of
  5.  * the License at http://www.mozilla.org/NPL/
  6.  *  
  7.  * Software distributed under the License is distributed on an "AS
  8.  * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
  9.  * implied. See the License for the specific language governing
  10.  * rights and limitations under the License.
  11.  *  
  12.  * The Original Code is Mozilla Communicator client code, released
  13.  * March 31, 1998.
  14.  * 
  15.  * The Initial Developer of the Original Code is Netscape
  16.  * Communications Corporation. Portions created by Netscape are
  17.  * Copyright (C) 1998-1999 Netscape Communications Corporation. All
  18.  * Rights Reserved.
  19.  * 
  20.  * Contributor(s): 
  21.  *   Ben Goodger (03/11/99)
  22.  */
  23.  
  24. //var bundle = srGetStrBundle("chrome://communicator/locale/profile/newProfile1_2.properties");
  25. //var detect = false;
  26.  
  27. // the getting procedure is unique to each page, since each page can different
  28. // types of elements (not necessarily form elements). So each page must provide
  29. // its own GetFields function
  30. function GetFields()
  31. {
  32.   var emailaddr = "dummy"
  33.   var rv = { 
  34.     emailaddr: { id: "emailaddr",      value: emailaddr       },
  35.  
  36.   }
  37.   return rv; 
  38. }
  39.  
  40. // the setting procedure is unique to each page, and as such each page
  41. // must provide its own SetFields function
  42. function SetFields(element,set)
  43. {
  44.   //element = document.getElementById(element);
  45.   //dump("In SetFields(" + element + "," + set + ");\n");
  46.  //if(element.id == "emailaddr")
  47.    // element.value = set;
  48. }  
  49.  
  50. // function createProfileWizard.js::chooseFolder();
  51. // utility function responsible for displaying a folder selection dialog.
  52. function chooseFolder(string)
  53. {
  54.     try {
  55.     var fileSpec = Components.classes["@mozilla.org/filespecwithui;1"].createInstance();
  56.     if(fileSpec) {
  57.       fileSpec = fileSpec.QueryInterface(Components.interfaces.nsIFileSpecWithUI);
  58.       return fileSpec.chooseDirectory(string);
  59.     } else 
  60.       return false;
  61.   } catch(e) {
  62.     return false;
  63.   }
  64. }
  65.  
  66. // tree picker
  67.  function picker(e){
  68.      targetValue=e.target.getAttribute("value");
  69.  
  70.          addBuddyButton = document.getElementById("btnaddbuddy");
  71.          imButton = document.getElementById("btnim");
  72.  
  73.      
  74.      
  75.     if((targetValue!="Screen name")&&(e.target.tagName=="treecell")){     
  76.  
  77.         addBuddyButton.setAttribute("onclick","openDialog('chrome://aim/content/BuddyAddBuddy.xul','','modal=yes,titlebar,chrome', null, null,'"+targetValue+"');")
  78.      
  79.         imButton.setAttribute("onclick","aimIMInvokeIMForm('"+targetValue+"', null)");
  80.         clearTreeCellClass();
  81.         e.target.setAttribute("class","fafselected")
  82.      }
  83.      
  84.      //dump('e.target'+e.target.nodeName+"\n");
  85.      dump('reset addbuddy and imbutton \n');
  86.  
  87.  }
  88.  
  89. function clearTreeCellClass(){
  90.     treeCells=document.getElementsByTagName("treecell")
  91.     for(k=0;k<treeCells.length;k++){
  92.         if(treeCells.item(k).getAttribute("issearchresult") == "true"){
  93.             treeCells.item(k).setAttribute("class","")
  94.         }
  95.     }
  96. }
  97.  
  98.  
  99. // show results
  100.  
  101.  
  102. function showRes(){
  103.  
  104.     //dump('showres:containerarray.length' +parent.containerArray.length +"\n");
  105.     //dump('showres:parent.containernode.childnodes.length:' +parent.containerNode.childNodes.length+"\n");
  106.  
  107.     
  108.     
  109.     document.getElementById("usersnum").setAttribute("value",parent.numHits);
  110.     //ff1_2numHits.appendChild(parent.numHits);
  111.     
  112.     
  113.     document.getElementById("emailaddress").setAttribute("value", parent.queryEmailAddress);
  114.     //ff1_2queryEmailAddress.appendChild(parent.queryEmailAddress);
  115.  
  116.     var searchResults = document.getElementById('theresults');
  117.     
  118.     var searchResultsArray = parent.containerArray;
  119.     var searchRowArray = new Array();
  120.     var searchCellArray = new Array();
  121.     
  122.  
  123.  
  124.     for(k=0;k<searchResultsArray.length;k++){
  125.         searchRowArray[k] = document.createElement("treerow");
  126.         searchCellArray[k] = document.createElement("treecell");
  127.         searchCellArray[k].setAttribute("value",searchResultsArray[k]);
  128.         searchCellArray[k].setAttribute("issearchresult","true");
  129.         searchRowArray[k].appendChild(searchCellArray[k]);
  130.         searchResults.appendChild(searchRowArray[k]);
  131.         
  132.     }
  133.     
  134.     searchResultsArray.length=0;
  135.  
  136. }
  137.  
  138.